package com.wgo.precise.client.ui.view.projecttree;

import static com.wgo.precise.client.ui.controller.PrecisePluginImage.IMG_CREATE_PROPERTY_SET;

import com.wgo.precise.client.ui.controller.RequirementPlugin;
import com.wgo.precise.client.ui.model.PropertySetWrapper;
import com.wgo.precise.client.ui.model.facade.ModelSystem;
import com.wgo.precise.common.VO.PropertySet;

/**
 * 
 * @author Petter L. H. Eide
 * @version $Id: CreatePropertySetAction.java,v 1.2 2006-01-30 21:52:33 petterei Exp $
 */
public class CreatePropertySetAction extends CreateAction<PropertySetWrapper, ModelSystem<PropertySetWrapper>> {

    public CreatePropertySetAction() {
        super(createText(PropertySet.class.getSimpleName()), null, IMG_CREATE_PROPERTY_SET.getImageDescriptor());
    }

    /**
     * @see com.wgo.precise.client.ui.view.projecttree.CrudAction#run()
     */
    @Override
    public void run() {
    	ModelSystem<PropertySetWrapper> systemWrapper = RequirementPlugin.getInstance().getSession().getWrapperFactory().getSystem(PropertySetWrapper.class); 
    	setItem(systemWrapper);
        PropertySet propertySet = RequirementPlugin.getInstance().getSession().getDomainSession().createPersistent(PropertySet.class);
        PropertySetWrapper item = RequirementPlugin.getInstance().getSession().getWrapperFactory().getWrapper(propertySet);
        item.setParent(systemWrapper);
        setNewItem(item);
        super.run();
    }

}
